<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--[if lt IE 9]>
      <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
      <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
    <![endif]-->
    <!-- 引入bootstrap样式文件 -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <title>22106105的网页</title>
    <style>

     body {
            padding-top: 20px;
            background: url('v2-c331bd104cd0a4a6c61a8ea3e0b84080_r.jpg') no-repeat center center fixed;
            background-size: cover;
        }
        .login-register-form {
            max-width: 400px;
            margin: auto;
            background-color: #fff;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        .hidden {
            display: none;
        }
  </style>
</head>

<body>
  <div class="login-register-form">
      <h2 class="text-center mb-4">用户登录</h2>
      <form id="loginForm">
          <div class="mb-3">
              <label for="username" class="form-label">用户名</label>
              <input type="text" class="form-control" id="username" placeholder="请输入用户名">
          </div>
          <div class="mb-3">
              <label for="password" class="form-label">密码</label>
              <input type="password" class="form-control" id="password" placeholder="请输入密码">
          </div>
          <div class="d-grid">
              <button type="submit" class="btn btn-primary">登录</button>
          </div>
          <div class="text-center mt-3">
              <a href="#" onclick="toggleForm()">没有账号？立即注册</a>
          </div>
      </form>

      <form id="registerForm" class="hidden">
          <h2 class="text-center mb-4">用户注册</h2>
          <div class="mb-3">
              <label for="reg_username" class="form-label">用户名</label>
              <input type="text" class="form-control" id="reg_username" placeholder="请输入用户名">
          </div>
          <div class="mb-3">
            <label for="reg_youname" class="form-label">邮箱</label>
            <input type="text" class="form-control" id="reg_youname" placeholder="请输入邮箱">
        </div>
          <div class="mb-3">
              <label for="reg_password" class="form-label">密码</label>
              <input type="password" class="form-control" id="reg_password" placeholder="请输入密码">
          </div>
          <div class="mb-3">
              <label for="confirm_password" class="form-label">确认密码</label>
              <input type="password" class="form-control" id="confirm_password" placeholder="请再次输入密码">
          </div>
          <div class="d-grid">
              <button type="submit" class="btn btn-success">注册</button>
          </div>
          <div class="text-center mt-3">
              <a href="#" onclick="toggleForm()">已有账号？立即登录</a>
          </div>
      </form>
  </div>

  <!-- Bootstrap Bundle with Popper -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
  <script>
      function toggleForm() {
          var loginForm = document.getElementById('loginForm');
          var registerForm = document.getElementById('registerForm');
          if (loginForm.classList.contains('hidden')) {
              loginForm.classList.remove('hidden');
              registerForm.classList.add('hidden');
          } else {
              loginForm.classList.add('hidden');
              registerForm.classList.remove('hidden');
          }
      }
  </script>
</body>

</html>